import { request } from "@/utils/request";

// 请求选车列表的函数
export const fetchSelectCarList = () => {
  return request({
    url: "/api",
  });
};

export interface CarDetailState {
  brand_id: number;
  device_id?: number;
  city_name?: string;
}

// 请求选车详情接口
export const fetchSelectCarDetail = (params: CarDetailState) => {
  return request({
    url: "/detail",
    params,
  });
};

// 首页tab数据接口
export const fetchTabList = () => {
  return request({
    url: "/api/tab/list",
  });
};

// 首页详情数据接口
export const fetchDetailItem = (id: string) => {
  return request({
    url: "/api/post",
    method: "post",
    data: {
      id,
    },
  });
};

// 登录接口
export const login = (data: { username: string, password: string }) => {
  return request({
    url: '/api/login',
    method: 'post',
    data
  })
}
